package com.jwds.digital.bios.business.service.health;

import com.jwds.digital.bios.business.core.infrastructure.entity.belt.BeltElectricParameters;
import com.jwds.digital.bios.business.core.infrastructure.entity.belt.BeltHealthConfig;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class HealthScoreDB {


    private static final Map<String, List<BeltHealthConfig>> BELT_HEALTH_CONFIG_MAP = new HashMap<>();

    public static void refresh(List<BeltHealthConfig> beltHealthConfigs) {
        BELT_HEALTH_CONFIG_MAP.clear();

        for (BeltHealthConfig config : beltHealthConfigs) {
            String deductionItem = config.getDeductionItem();
            List<BeltHealthConfig> configList = BELT_HEALTH_CONFIG_MAP.get(deductionItem);
            if (configList == null) {
                configList = new ArrayList<>();
                BELT_HEALTH_CONFIG_MAP.put(deductionItem, configList);
            }
            configList.add(config);
        }

    }
    public static List<BeltHealthConfig> getBeltHealthConfig(String deductionItem) {
        return BELT_HEALTH_CONFIG_MAP.get(deductionItem);
    }
}
